package com.atzhou.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class EmployeeException {
    @ExceptionHandler(value = Exception.class)
    public ModelAndView hanldException(Exception ex){
        System.out.println("全局指定的异常处理器："+ex);
        ModelAndView modelAndView = new ModelAndView("allException");
        modelAndView.addObject("ex","服务器存在异常，请联系后台管理员！");
        return modelAndView;
    }
}
